<?php
namespace home\Controller;
use Think\Controller;
class CommonController extends Controller {
	// 初始化
    public function _initialize()
    {
    	$auth = C('AUTH_CONTROL') ? C('AUTH_CONTROL'): array();
    	// 循环控制器的名字，
    	foreach ($auth as $v) {
    		if(strtolower(CONTROLLER_NAME)==strtolower($v)){
    			if(!isset($_SESSION['id'])){
		    		$this->error('亲把权限掉在路上了，去找回先吧...',U('home/login/login'));
		    	}
		    	break;
    		}
    	}

    	$categorys = M('category')->select();

    	$this->assign('categorys',$categorys);
    }
}
?>
